import Vue from 'vue'
import App from './App.vue'
import './element'
import './element-variables.scss'

Vue.config.productionTip = false

/**全局调用login */
import CustomModel from './components/customModel'
Vue.use(CustomModel)

function showLogin() {
  // console.log('app before :>> ', document.querySelectorAll('#loginModel'))
  // if (document.querySelectorAll('#loginModel').length != 0) {
  //   return
  // }
  const Dialog = Vue.extend(CustomModel)
  const app = new Dialog().$mount(document.createElement('div'))
  let ops = {
    modelShow: true,
    showType: 'login',
  }
  for (let key in ops) {
    app[key] = ops[key]
  }
  app.$el.id = 'loginModel'
  document.body.appendChild(app.$el)
  // console.log('app:>> ', document.querySelectorAll('#loginModel'))
}

Vue.prototype.$showLogin = showLogin

const vueApp = new Vue({
  render: (h) => h(App),
}).$mount('#app')
export default vueApp
